<template>
    <el-table :data="lessorsAccount" border style="width: 100%">
        <el-table-column prop="account" label="出租方账户"> </el-table-column>
        <!-- <el-table-column prop="password" label="密码"> </el-table-column> -->
        <el-table-column prop="phone" label="电话"> </el-table-column>
        <el-table-column label="状态">
            <template slot-scope="scope">
                <!-- 用函数判断出租方使用状态 -->
                {{ state(scope.row.state) }}
            </template>
        </el-table-column>
        <el-table-column prop="credits" label="信用值"> </el-table-column>
    </el-table>
</template>

<script>
import { createNamespacedHelpers } from "vuex";
const { mapActions, mapState } = createNamespacedHelpers("lessors");
export default {
    mounted() {
        // 调用验证是否携带token的函数并且拿到用户数据
        this.isLogin();
    },
    computed: {
        ...mapState(["lessorsAccount"]),
    },
    methods: {
        ...mapActions(["isLogin"]),
        state(state) {
            if (state == 1) {
                return "正常使用";
            } else if (state == 2) {
                return "冻结";
            }
        },
    },
};
</script>

<style>
</style>